package com.zz.hhbl.utils.itemdecoration.ext

import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView

internal fun RecyclerView.itemCount(): Int {
    return this.adapter?.itemCount ?: 0
}

internal fun RecyclerView.itemType(itemPosition: Int): Int {
    return this.adapter?.getItemViewType(itemPosition) ?: -1
}

internal fun GridLayoutManager.spanSize(itemPosition: Int): Int {
    return this.spanSizeLookup.getSpanSize(itemPosition)
}

internal fun GridLayoutManager.spanIndex(itemPosition: Int): Int {
    return this.spanSizeLookup.getSpanIndex(itemPosition, spanCount)
}